<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAkbusPersonnelWorkExperienceTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('akbus_personnel_work_experience', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->date('start_at')->nullable()->comment('开始时间');
            $table->date('end_at')->nullable()->comment('结束时间');
            $table->string('unit')->nullable()->comment('单位');
            $table->string('office')->nullable()->comment('职位');
            $table->string('reason')->nullable()->comment('离职原因');

            $table->unsignedBigInteger('personnel_id')->comment('人员ID');
            $table->foreign('personnel_id')->references('id')->on('akbus_personnel')->onDelete('cascade');

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('akbus_personnel_work_experience');
    }
}
